#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import pymysql as MySQLdb
import logging
logger = logging.getLogger(__name__)


class DBServer:
    def __init__(self, *args, **kwargs):
        self.db = MySQLdb.connect(*args, **kwargs)
        self.c = self.db.cursor()  # 创建新的会话

    def execute_sql(self, sql):
        self.c.execute(sql)  # 执行sql命令

        res = self.c.fetchone()  # 返回单行结果
        # res = self.c.fetchall()     # 返回多行结果
        return res


db = DBServer(
    host="172.31.115.175",
    port=5734,
    user="app_ynfp_rw",
    password="H3hJqVC@w1O8r1xz",
    database="ynfp_dev_ali",
)

